<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of cargo_documents
 *
 * @author Chris Sim
 */
class cargo_documents extends documents {
    //put your code here
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'documents';
    }

    public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('name, file_loc, foreign_key, for_model', 'required'),
            array('foreign_key', 'numerical', 'integerOnly' => true),
            array('name, for_model', 'length', 'max' => 50),
            array('file_loc', 'length', 'max' => 2048),
            array('remark', 'length', 'max' => 125),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('id, name, file_loc, foreign_key, for_model, remark', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    public function upload(){
        $this->for_model = 'cargo';
        return parent::upload();
    }
}
?>
